package me.softwareengineer.guice.rendering.domain;

import java.util.List;
import java.util.Map;

import me.softwareengineer.guice.rendering.listener.EndQuotationEvent;
import me.softwareengineer.guice.rendering.listener.Listener;
import me.softwareengineer.guice.rendering.listener.StartQuotationEvent;

/**
 * Holds quotation elements. Usually, quotation elements are
 * {@link QuotationElement}
 * 
 * @author yadtahir
 * @see QuotationLineElement <pre>
 * This class is thread-safe and can be cached/re-used and used concurrently.
 * </pre>
 */
public class QuotationElement extends Element {

	/**
	 * Create a quotation element without properties
	 * 
	 * @param children
	 *            the chidlren of the element
	 */
	public QuotationElement(List<Element> children) {
		super(children);
	}

	/**
	 * Create a quotation element with properties
	 * 
	 * @param children
	 *            the chidlren of the element
	 * @param properties
	 *            the properties of the element
	 */
	public QuotationElement(List<Element> children,
			Map<String, String> properties) {
		super(children, properties);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void afterElement(Listener listener) {
		EndQuotationEvent e = new EndQuotationEvent(getAllProperties());
		listener.onEvent(e);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void beforeElement(Listener listener) {
		StartQuotationEvent e = new StartQuotationEvent(getAllProperties());
		listener.onEvent(e);
	}
}
